package com.healthcare.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.healthcare.admin.pojo.Sysuser;
import com.healthcare.admin.mapper.SysuserMapper;
import com.healthcare.admin.pojo.User;
import com.healthcare.admin.service.SysuserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 后台系统用户 服务实现类
 * </p>
 *
 * @author 新华医院转诊联盟
 * @since 2020-04-12
 */
@Service
public class SysuserServiceImpl extends ServiceImpl<SysuserMapper, Sysuser> implements SysuserService {

    /**
     * 后台用户登陆实现
     * @param user
     * @return
     */
    @Override
    public Sysuser findUserVoByUsernameAndPassword(Sysuser user) {
        QueryWrapper<Sysuser> queryWrapper = new QueryWrapper<>(); //创建QueryWrapper对象
        queryWrapper.eq("username",user.getUsername()).eq("password",user.getPassword());//判断数据库是否操作用户名和密码是否对应
        Sysuser SysUser = (Sysuser) baseMapper.selectOne(queryWrapper);
        if (SysUser != null) { //判断用户是否为空
            return SysUser;
        }
        return null;
    }

    /**
     * 后台用户密码修改
     */
    @Override
    public void updateNewByCondition(Sysuser user) {

    }

}
